﻿
Partial Class App_esempio1_rifaccio
    Inherits MyUI.PageBaseApp

    Sub PopulateGrid()

        Dim users = MyDBase.mDB.GetDB.TAB.User
        utenti.DataSource = users.ToList
        utenti.DataBind()

    End Sub


    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            PopulateGrid()
        End If
    End Sub

    Protected Sub utenti_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles utenti.RowDeleting
        Dim ct = e.RowIndex
        Dim userId = sender.datakeys(ct).value
        Dim user = MyDBase.mDB.GetDB.TAB.User.Where("UserID", "=", userId).Delete
        MyDBase.mDB.GetDB.SubmitChanges()
    End Sub

    Protected Sub utenti_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles utenti.RowUpdating
        utenti.EditIndex = e.RowIndex

        PopulateGrid()
    End Sub


End Class
